<template>

<div>
<el-upload
  class="upload-demo"
  drag
  action="http://localhost:8090/admin/upload"
  multiple>
  <i class="el-icon-upload"></i>
  <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
  <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div>
</el-upload>

</div>
    
</template>
<script>
export default {
    data() {
        return {
           
        }
    },methods: {
     uploadFile(file) {
      this.imgUrl = file.raw // 拿到文件的信息
   },
    httpRequest(a) { //上传成功
      this.httpRequestImg = true;
      
    },
    handlePictureCardPreview(file) { //预览
      this.dialogImageUrl = file.url;
      this.dialogVisibleImg = true;
    },
    handleRemove(file, fileList) { //删除
      this.httpRequestImg = false;
      console.log(file, fileList);
    },
    submitForm() {
      let formdata = new FormData()
      formdata.append("head", this.imgUrl)
       let authUser=this.$qs.parse(sessionStorage.getItem("authUser"))
      formdata.append("uid", authUser.uid)
      axios({
        method: 'post',
        url: 'http://localhost:8090/admin/upload',
        data:formdata,
        headers: {
          "Authorization":sessionStorage.getItem("token"),
          'Content-Type': 'multipart/form-data'
        }
      }).then(res=>{
        console.log(res)
        this.dialogVisible=false
        location.reload()
      })
    },
    }
}

</script>
<style scoped>
.video-js .vjs-icon-placeholder {
    width: 100%;
    height: 100%;
    display: block;
}
</style>